import 'package:flutter/material.dart';
import 'package:shenling_flutter/pages/home/components/Intransit.dart';
import 'package:shenling_flutter/pages/home/components/finish.dart';
import 'package:shenling_flutter/pages/home/components/pickUp.dart';
import 'package:shenling_flutter/utils/auth.dart';

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage>
    with SingleTickerProviderStateMixin {
  late TabController _tabController;

  @override
  void initState() {
    super.initState();
    _tabController = TabController(length: 3, vsync: this);
  }

  @override
  void dispose() {
    _tabController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        // 使用 SafeArea 包裹内容，避免与状态栏重叠
        child: Column(
          children: [
            // 顶部 TabBar
            TabBar(
              controller: _tabController,
              labelColor: Colors.black,
              unselectedLabelColor: Colors.grey,
              //指示器颜色
              indicatorColor: Colors.red,
              tabs: const [
                Tab(text: '待提货'),
                Tab(text: '在途'),
                Tab(text: '已完成'),
              ],
            ),
            // 内容区域
            Expanded(
              child: TabBarView(
                controller: _tabController,
                physics: const NeverScrollableScrollPhysics(),
                children: const [Pickup(), Intransit(), Finish()],
              ),
            )
          ],
        ),
      ),
    );
  }
}
